package com.xiaomili.halfsugar.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.xiaomili.halfsugar.R;

import java.io.File;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/7/24 0024.
 */
public class OnePicActivity extends Activity {
    @InjectView(R.id.tv_cancle)
    TextView tvCancle;
    @InjectView(R.id.iv_romote)
    ImageView ivRomote;
    @InjectView(R.id.tv_next)
    TextView tvNext;
    private ImageView iv_pic;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_onepic);
        ButterKnife.inject(this);
        iv_pic = (ImageView) findViewById(R.id.iv_pic);
        final Intent intent = getIntent();
        String str = intent.getStringExtra("path");
        if (str != null) {
            Picasso.with(this)
                    .load(new File(str))
                    .into(iv_pic);
        }
    }

    @OnClick({R.id.tv_cancle, R.id.iv_romote, R.id.tv_next})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_cancle:
                startActivity(new Intent(this, PicActivity.class));
                break;
            case R.id.iv_romote:
                Animation a = AnimationUtils.loadAnimation(this, R.anim.myrotate);
                iv_pic.startAnimation(a);
                break;
            case R.id.tv_next:
                break;
        }
    }
}
